]> dgit.raspbian.org Git - openjdk-25.git/commitdiff
[PATCH] 8371066: Remove unused class TextSourceLabel and associated class hierarchy...
authorDaniel Gredler <dgredler@openjdk.org>
Wed, 12 Nov 2025 14:42:30 +0000 (14:42 +0000)
committerVladimir Petko <vladimir.petko@canonical.com>
Thu, 24 Sep 2026 07:52:19 +0000 (19:52 +1200)
From 4042e821c6f582bf31201acb9f2d98d940383f1c Mon Sep 17 00:00:00 2001
Bug: https://bugs.openjdk.org/browse/JDK-8371066
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/openjdk-25/+bug/2155650
Origin: upstream, https://github.com/openjdk/jdk/commit/4042e821c6f582bf31201acb9f2d98d940383f1c
Reviewed-by: prr, psadhukhan
Reviewed-by: prr, psadhukhan
Gbp-Pq: Name jdk-8371066.diff

src/java.desktop/share/classes/java/awt/font/TextLine.java
src/java.desktop/share/classes/sun/font/Decoration.java
src/java.desktop/share/classes/sun/font/ExtendedTextLabel.java [deleted file]
src/java.desktop/share/classes/sun/font/ExtendedTextSourceLabel.java
src/java.desktop/share/classes/sun/font/TextLabel.java [deleted file]
src/java.desktop/share/classes/sun/font/TextLabelFactory.java
src/java.desktop/share/classes/sun/font/TextSourceLabel.java [deleted file]

index 681fcd900837aa3927adeea31da6cf48b89874bc..26062b9ae3875a297b378919a70da1e31f899122 100644 (file)
@@ -1018,7 +1018,7 @@ final class TextLine {
                 }
 
                 TextLineComponent nextComponent =
-                    factory.createExtended(font, cm, decorator, startPos, startPos + lmCount);
+                    factory.createTextLabel(font, cm, decorator, startPos, startPos + lmCount);
 
                 ++numComponents;
                 if (numComponents > components.length) {
index 26f5295d8d3b8c60d6ad052f4328b578f784648b..f131914134f56e671e83b1353b5f4bc92f95b8d5 100644 (file)
@@ -54,7 +54,8 @@ import static sun.font.EAttribute.*;
 /**
  * This class handles underlining, strikethrough, and foreground and
  * background styles on text.  Clients simply acquire instances
- * of this class and hand them off to ExtendedTextLabels or GraphicComponents.
+ * of this class and hand them off to ExtendedTextSourceLabels or
+ * GraphicComponents.
  */
 public class Decoration {
 
diff --git a/src/java.desktop/share/classes/sun/font/ExtendedTextLabel.java b/src/java.desktop/share/classes/sun/font/ExtendedTextLabel.java
deleted file mode 100644 (file)
index 2962d8f..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- *
- * (C) Copyright IBM Corp. 1998-2003- All Rights Reserved.
- */
-
-package sun.font;
-
-import java.awt.Font;
-
-import java.awt.font.GlyphJustificationInfo;
-import java.awt.font.LineMetrics;
-
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-/**
- * An extension of TextLabel that maintains information
- * about characters.
- */
-
-public abstract class ExtendedTextLabel extends TextLabel
-                            implements TextLineComponent{
-  /**
-   * Return the number of characters represented by this label.
-   */
-  public abstract int getNumCharacters();
-
-  /**
-   * Return the line metrics for all text in this label.
-   */
-  public abstract CoreMetrics getCoreMetrics();
-
-  /**
-   * Return the x location of the character at the given logical index.
-   */
-  public abstract float getCharX(int logicalIndex);
-
-  /**
-   * Return the y location of the character at the given logical index.
-   */
-  public abstract float getCharY(int logicalIndex);
-
-  /**
-   * Return the advance of the character at the given logical index.
-   */
-  public abstract float getCharAdvance(int logicalIndex);
-
-  /**
-   * Return the visual bounds of the character at the given logical index.
-   * This bounds encloses all the pixels of the character when the label is rendered
-   * at x, y.
-   */
-  public abstract Rectangle2D getCharVisualBounds(int logicalIndex, float x, float y);
-
-  /**
-   * Return the visual index of the character at the given logical index.
-   */
-  public abstract int logicalToVisual(int logicalIndex);
-
-  /**
-   * Return the logical index of the character at the given visual index.
-   */
-  public abstract int visualToLogical(int visualIndex);
-
-  /**
-   * Return the logical index of the character, starting with the character at
-   * logicalStart, whose accumulated advance exceeds width.  If the advances of
-   * all characters do not exceed width, return getNumCharacters.  If width is
-   * less than zero, return logicalStart - 1.
-   */
-  public abstract int getLineBreakIndex(int logicalStart, float width);
-
-  /**
-   * Return the accumulated advances of all characters between logicalStart and
-   * logicalLimit.
-   */
-  public abstract float getAdvanceBetween(int logicalStart, int logicalLimit);
-
-  /**
-   * Return whether a caret can exist on the leading edge of the
-   * character at offset.  If the character is part of a ligature
-   * (for example) a caret may not be appropriate at offset.
-   */
-  public abstract boolean caretAtOffsetIsValid(int offset);
-
-  /**
-   * A convenience overload of getCharVisualBounds that defaults the label origin
-   * to 0, 0.
-   */
-  public Rectangle2D getCharVisualBounds(int logicalIndex) {
-    return getCharVisualBounds(logicalIndex, 0, 0);
-  }
-
-  public abstract TextLineComponent getSubset(int start, int limit, int dir);
-
-  /**
-   * Return the number of justification records this uses.
-   */
-  public abstract int getNumJustificationInfos();
-
-  /**
-   * Return GlyphJustificationInfo objects for the characters between
-   * charStart and charLimit, starting at offset infoStart.  Infos
-   * will be in visual order.  All positions between infoStart and
-   * getNumJustificationInfos will be set.  If a position corresponds
-   * to a character outside the provided range, it is set to null.
-   */
-  public abstract void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit);
-
-  /**
-   * Apply deltas to the data in this component, starting at offset
-   * deltaStart, and return the new component.  There are two floats
-   * for each justification info, for a total of 2 * getNumJustificationInfos.
-   * The first delta is the left adjustment, the second is the right
-   * adjustment.
-   * <p>
-   * If flags[0] is true on entry, rejustification is allowed.  If
-   * the new component requires rejustification (ligatures were
-   * formed or split), flags[0] will be set on exit.
-   */
-  public abstract TextLineComponent applyJustificationDeltas(float[] deltas, int deltaStart, boolean[] flags);
-}
index d7cf30ad69b6568cdae0f5f68e7deca6e95764d4..f3569941321d9814cbbd7c70685f0e963c39e705 100644 (file)
@@ -46,32 +46,35 @@ import java.awt.geom.Rectangle2D;
 
 import java.util.Map;
 
-/**
- * Default implementation of ExtendedTextLabel.
- */
-
 // {jbr} I made this class package-private to keep the
 // Decoration.Label API package-private.
 
-/* public */
-class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.Label {
+/**
+ * A label.
+ * Visual bounds is a rect that encompasses the entire rendered area.
+ * Logical bounds is a rect that defines how to position this next
+ * to other objects.
+ * Align bounds is a rect that defines how to align this to margins.
+ * it generally allows some overhang that logical bounds would prevent.
+ */
+class ExtendedTextSourceLabel implements TextLineComponent, Decoration.Label {
 
-  TextSource source;
-  private Decoration decorator;
+  private final TextSource source;
+  private final Decoration decorator;
 
   // caches
   private Font font;
   private AffineTransform baseTX;
   private CoreMetrics cm;
 
-  Rectangle2D lb;
-  Rectangle2D ab;
-  Rectangle2D vb;
-  Rectangle2D ib;
-  StandardGlyphVector gv;
-  float[] charinfo;
+  private Rectangle2D lb;
+  private Rectangle2D ab;
+  private Rectangle2D vb;
+  private Rectangle2D ib;
+  private StandardGlyphVector gv;
+  private float[] charinfo;
 
-  float advTracking;
+  private float advTracking;
 
   /**
    * Create from a TextSource.
@@ -116,13 +119,11 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     advTracking = font.getSize() * AttributeValues.getTracking(atts);
   }
 
-
-  // TextLabel API
-
-  public Rectangle2D getLogicalBounds() {
-    return getLogicalBounds(0, 0);
-  }
-
+  /**
+   * Return a rectangle that corresponds to the logical bounds of the text
+   * when this label is rendered at x, y.
+   * This rectangle is used when positioning text next to other text.
+   */
   public Rectangle2D getLogicalBounds(float x, float y) {
     if (lb == null) {
       lb = createLogicalBounds();
@@ -133,13 +134,16 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
                                  (float)lb.getHeight());
   }
 
-    public float getAdvance() {
-        if (lb == null) {
-            lb = createLogicalBounds();
-        }
-        return (float)lb.getWidth();
+  public float getAdvance() {
+    if (lb == null) {
+      lb = createLogicalBounds();
     }
+    return (float)lb.getWidth();
+  }
 
+  /**
+   * Return a rectangle that surrounds the text outline when this label is rendered at x, y.
+   */
   public Rectangle2D getVisualBounds(float x, float y) {
     if (vb == null) {
       vb = decorator.getVisualBounds(this);
@@ -150,6 +154,12 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
                                  (float)vb.getHeight());
   }
 
+  /**
+   * Return a rectangle that corresponds to the alignment bounds of the text
+   * when this label is rendered at x, y. This rectangle is used when positioning text next
+   * to a margin.  It differs from the logical bounds in that it does not include leading or
+   * trailing whitespace.
+   */
   public Rectangle2D getAlignBounds(float x, float y) {
     if (ab == null) {
       ab = createAlignBounds();
@@ -161,6 +171,10 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
 
   }
 
+  /**
+   * Return a rectangle that corresponds to the logical bounds of the text, adjusted
+   * to angle the leading and trailing edges by the italic angle.
+   */
   public Rectangle2D getItalicBounds(float x, float y) {
     if (ib == null) {
       ib = createItalicBounds();
@@ -189,6 +203,9 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     return getGV().getOutline(x, y);
   }
 
+  /**
+   * Return an outline of the characters in the label when rendered at x, y.
+   */
   public Shape getOutline(float x, float y) {
     return decorator.getOutline(this, x, y);
   }
@@ -197,10 +214,63 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     g.drawGlyphVector(getGV(), x, y);
   }
 
+  /**
+   * Render the label at x, y in the graphics.
+   */
   public void draw(Graphics2D g, float x, float y) {
     decorator.drawTextAndDecorations(this, g, x, y);
   }
 
+  /**
+   * A convenience method that returns the visual bounds when rendered at 0, 0.
+   */
+  public Rectangle2D getVisualBounds() {
+    return getVisualBounds(0f, 0f);
+  }
+
+  /**
+   * A convenience method that returns the logical bounds when rendered at 0, 0.
+   */
+  public Rectangle2D getLogicalBounds() {
+    return getLogicalBounds(0f, 0f);
+  }
+
+  /**
+   * A convenience method that returns the align bounds when rendered at 0, 0.
+   */
+  public Rectangle2D getAlignBounds() {
+    return getAlignBounds(0f, 0f);
+  }
+
+  /**
+   * A convenience method that returns the italic bounds when rendered at 0, 0.
+   */
+  public Rectangle2D getItalicBounds() {
+    return getItalicBounds(0f, 0f);
+  }
+
+  /**
+   * A convenience method that returns the outline when rendered at 0, 0.
+   */
+  public Shape getOutline() {
+    return getOutline(0f, 0f);
+  }
+
+  /**
+   * A convenience method that renders the label at 0, 0.
+   */
+  public void draw(Graphics2D g) {
+    draw(g, 0f, 0f);
+  }
+
+  /**
+   * A convenience overload of getCharVisualBounds that defaults the label origin
+   * to 0, 0.
+   */
+  public Rectangle2D getCharVisualBounds(int logicalIndex) {
+    return getCharVisualBounds(logicalIndex, 0, 0);
+  }
+
   /**
    * The logical bounds extends from the origin of the glyphvector to the
    * position at which a following glyphvector's origin should be placed.
@@ -336,8 +406,6 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     return gv;
   }
 
-  // ExtendedTextLabel API
-
   private static final int posx = 0,
     posy = 1,
     advx = 2,
@@ -348,14 +416,23 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     vish = 7;
   private static final int numvals = 8;
 
+  /**
+   * Return the number of characters represented by this label.
+   */
   public int getNumCharacters() {
     return source.getLength();
   }
 
+  /**
+   * Return the line metrics for all text in this label.
+   */
   public CoreMetrics getCoreMetrics() {
     return cm;
   }
 
+  /**
+   * Return the x location of the character at the given logical index.
+   */
   public float getCharX(int index) {
     validate(index);
     float[] charinfo = getCharinfo();
@@ -367,6 +444,9 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     }
   }
 
+  /**
+   * Return the y location of the character at the given logical index.
+   */
   public float getCharY(int index) {
     validate(index);
     float[] charinfo = getCharinfo();
@@ -378,6 +458,9 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     }
   }
 
+  /**
+   * Return the advance of the character at the given logical index.
+   */
   public float getCharAdvance(int index) {
     validate(index);
     float[] charinfo = getCharinfo();
@@ -403,6 +486,11 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
                                  charinfo[index + vish]);
   }
 
+  /**
+   * Return the visual bounds of the character at the given logical index.
+   * This bounds encloses all the pixels of the character when the label is rendered
+   * at x, y.
+   */
   public Rectangle2D getCharVisualBounds(int index, float x, float y) {
 
     Rectangle2D bounds = decorator.getCharVisualBounds(this, index);
@@ -470,16 +558,28 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     }
     */
 
+  /**
+   * Return the visual index of the character at the given logical index.
+   */
   public int logicalToVisual(int logicalIndex) {
     validate(logicalIndex);
     return l2v(logicalIndex);
   }
 
+  /**
+   * Return the logical index of the character at the given visual index.
+   */
   public int visualToLogical(int visualIndex) {
     validate(visualIndex);
     return v2l(visualIndex);
   }
 
+  /**
+   * Return the logical index of the character, starting with the character at
+   * logicalStart, whose accumulated advance exceeds width.  If the advances of
+   * all characters do not exceed width, return getNumCharacters.  If width is
+   * less than zero, return logicalStart - 1.
+   */
   public int getLineBreakIndex(int start, float width) {
     final float epsilon = 0.005f;
 
@@ -504,6 +604,10 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     return start;
   }
 
+  /**
+   * Return the accumulated advances of all characters between logicalStart and
+   * logicalLimit.
+   */
   public float getAdvanceBetween(int start, int limit) {
     float a = 0f;
 
@@ -523,6 +627,11 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     return a;
   }
 
+  /**
+   * Return whether a caret can exist on the leading edge of the
+   * character at offset.  If the character is part of a ligature
+   * (for example) a caret may not be appropriate at offset.
+   */
   public boolean caretAtOffsetIsValid(int offset) {
       // REMIND: improve this implementation
 
@@ -912,15 +1021,20 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     return sb.toString();
   }
 
-  //public static ExtendedTextLabel create(TextSource source) {
-  //  return new ExtendedTextSourceLabel(source);
-  //}
-
+  /**
+   * Return the number of justification records this uses.
+   */
   public int getNumJustificationInfos() {
     return getGV().getNumGlyphs();
   }
 
-
+  /**
+   * Return GlyphJustificationInfo objects for the characters between
+   * charStart and charLimit, starting at offset infoStart.  Infos
+   * will be in visual order.  All positions between infoStart and
+   * getNumJustificationInfos will be set.  If a position corresponds
+   * to a character outside the provided range, it is set to null.
+   */
   public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) {
     // This simple implementation only uses spaces for justification.
     // Since regular characters aren't justified, we don't need to deal with
@@ -992,6 +1106,17 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
     }
   }
 
+  /**
+   * Apply deltas to the data in this component, starting at offset
+   * deltaStart, and return the new component.  There are two floats
+   * for each justification info, for a total of 2 * getNumJustificationInfos.
+   * The first delta is the left adjustment, the second is the right
+   * adjustment.
+   * <p>
+   * If flags[0] is true on entry, rejustification is allowed.  If
+   * the new component requires rejustification (ligatures were
+   * formed or split), flags[0] will be set on exit.
+   */
   public TextLineComponent applyJustificationDeltas(float[] deltas, int deltaStart, boolean[] flags) {
 
     // when we justify, we need to adjust the charinfo since spaces
diff --git a/src/java.desktop/share/classes/sun/font/TextLabel.java b/src/java.desktop/share/classes/sun/font/TextLabel.java
deleted file mode 100644 (file)
index 738ff0c..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- *
- * (C) Copyright IBM Corp. 1998-2003 All Rights Reserved
- */
-
-package sun.font;
-
-import java.awt.Graphics2D;
-import java.awt.Shape;
-
-import java.awt.geom.Rectangle2D;
-
-/**
- * A label.
- * Visual bounds is a rect that encompasses the entire rendered area.
- * Logical bounds is a rect that defines how to position this next
- * to other objects.
- * Align bounds is a rect that defines how to align this to margins.
- * it generally allows some overhang that logical bounds would prevent.
- */
-public abstract class TextLabel {
-
-  /**
-   * Return a rectangle that surrounds the text outline when this label is rendered at x, y.
-   */
-  public abstract Rectangle2D getVisualBounds(float x, float y);
-
-  /**
-   * Return a rectangle that corresponds to the logical bounds of the text
-   * when this label is rendered at x, y.
-   * This rectangle is used when positioning text next to other text.
-   */
-  public abstract Rectangle2D getLogicalBounds(float x, float y);
-
-  /**
-   * Return a rectangle that corresponds to the alignment bounds of the text
-   * when this label is rendered at x, y. This rectangle is used when positioning text next
-   * to a margin.  It differs from the logical bounds in that it does not include leading or
-   * trailing whitespace.
-   */
-  public abstract Rectangle2D getAlignBounds(float x, float y);
-
-  /**
-   * Return a rectangle that corresponds to the logical bounds of the text, adjusted
-   * to angle the leading and trailing edges by the italic angle.
-   */
-  public abstract Rectangle2D getItalicBounds(float x, float y);
-
-  /**
-   * Return an outline of the characters in the label when rendered at x, y.
-   */
-  public abstract Shape getOutline(float x, float y);
-
-  /**
-   * Render the label at x, y in the graphics.
-   */
-  public abstract void draw(Graphics2D g, float x, float y);
-
-  /**
-   * A convenience method that returns the visual bounds when rendered at 0, 0.
-   */
-  public Rectangle2D getVisualBounds() {
-    return getVisualBounds(0f, 0f);
-  }
-
-  /**
-   * A convenience method that returns the logical bounds when rendered at 0, 0.
-   */
-  public Rectangle2D getLogicalBounds() {
-    return getLogicalBounds(0f, 0f);
-  }
-
-  /**
-   * A convenience method that returns the align bounds when rendered at 0, 0.
-   */
-  public Rectangle2D getAlignBounds() {
-    return getAlignBounds(0f, 0f);
-  }
-
-  /**
-   * A convenience method that returns the italic bounds when rendered at 0, 0.
-   */
-  public Rectangle2D getItalicBounds() {
-    return getItalicBounds(0f, 0f);
-  }
-
-  /**
-   * A convenience method that returns the outline when rendered at 0, 0.
-   */
-  public Shape getOutline() {
-    return getOutline(0f, 0f);
-  }
-
-  /**
-   * A convenience method that renders the label at 0, 0.
-   */
-  public void draw(Graphics2D g) {
-    draw(g, 0f, 0f);
-  }
-}
index d245f33b8af990fd6090de8570b70a11d411842c..856887ce4bad91c0d64b5cec7b43edc7cca6d203 100644 (file)
@@ -42,8 +42,7 @@ import java.text.Bidi;
    * @see Font
    * @see FontRenderContext
    * @see java.awt.font.GlyphVector
-   * @see TextLabel
-   * @see ExtendedTextLabel
+   * @see ExtendedTextSourceLabel
    * @see Bidi
    * @see java.awt.font.TextLayout
    */
@@ -100,7 +99,7 @@ public final class TextLabelFactory {
   }
 
   /**
-   * Create an extended glyph array for the text between start and limit.
+   * Create a glyph array for the text between start and limit.
    *
    * @param font the font to use to generate glyphs and character positions.
    * @param start the start of the subrange for which to create the glyph array
@@ -113,11 +112,11 @@ public final class TextLabelFactory {
    * at start.  Clients should ensure that all text between start and limit
    * has the same bidi level for the current line.
    */
-  public ExtendedTextLabel createExtended(Font font,
-                                          CoreMetrics lm,
-                                          Decoration decorator,
-                                          int start,
-                                          int limit) {
+  public ExtendedTextSourceLabel createTextLabel(Font font,
+                                                 CoreMetrics lm,
+                                                 Decoration decorator,
+                                                 int start,
+                                                 int limit) {
 
     if (start >= limit || start < lineStart || limit > lineLimit) {
       throw new IllegalArgumentException("bad start: " + start + " or limit: " + limit);
@@ -133,28 +132,4 @@ public final class TextLabelFactory {
     return new ExtendedTextSourceLabel(source, decorator);
   }
 
-  /**
-   * Create a simple glyph array for the text between start and limit.
-   *
-   * @param font the font to use to generate glyphs and character positions.
-   * @param start the start of the subrange for which to create the glyph array
-   * @param limit the limit of the subrange for which to create glyph array
-   */
-  public TextLabel createSimple(Font font,
-                                CoreMetrics lm,
-                                int start,
-                                int limit) {
-
-    if (start >= limit || start < lineStart || limit > lineLimit) {
-      throw new IllegalArgumentException("bad start: " + start + " or limit: " + limit);
-    }
-
-    int level = lineBidi == null ? 0 : lineBidi.getLevelAt(start - lineStart);
-    int linedir = (lineBidi == null || lineBidi.baseIsLeftToRight()) ? 0 : 1;
-    int layoutFlags = flags & ~0x9; // remove bidi, line direction flags
-    if ((level & 0x1) != 0) layoutFlags |= 1; // rtl
-    if ((linedir & 0x1) != 0) layoutFlags |= 8; // line rtl
-    TextSource source = new StandardTextSource(text, start, limit - start, lineStart, lineLimit - lineStart, level, layoutFlags, font, frc, lm);
-    return new TextSourceLabel(source);
-  }
 }
diff --git a/src/java.desktop/share/classes/sun/font/TextSourceLabel.java b/src/java.desktop/share/classes/sun/font/TextSourceLabel.java
deleted file mode 100644 (file)
index 8514be6..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- *
- * (C) Copyright IBM Corp. 1998, 1999 - All Rights Reserved
- */
-
-package sun.font;
-
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphVector;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-
-/**
- * Implementation of TextLabel based on String.
- */
-
-public class TextSourceLabel extends TextLabel {
-  TextSource source;
-
-  // caches
-  Rectangle2D lb;
-  Rectangle2D ab;
-  Rectangle2D vb;
-  Rectangle2D ib;
-  GlyphVector gv;
-
-  public TextSourceLabel(TextSource source) {
-    this(source, null, null, null);
-  }
-
-  public TextSourceLabel(TextSource source, Rectangle2D lb, Rectangle2D ab, GlyphVector gv) {
-    this.source = source;
-
-    this.lb = lb;
-    this.ab = ab;
-    this.gv = gv;
-  }
-
-  public TextSource getSource() {
-    return source;
-  }
-
-  public final Rectangle2D getLogicalBounds(float x, float y) {
-    if (lb == null) {
-      lb = createLogicalBounds();
-    }
-    return new Rectangle2D.Float((float)(lb.getX() + x),
-                                 (float)(lb.getY() + y),
-                                 (float)lb.getWidth(),
-                                 (float)lb.getHeight());
-  }
-
-  public final Rectangle2D getVisualBounds(float x, float y) {
-    if (vb == null) {
-      vb = createVisualBounds();
-
-    }
-    return new Rectangle2D.Float((float)(vb.getX() + x),
-                                 (float)(vb.getY() + y),
-                                 (float)vb.getWidth(),
-                                 (float)vb.getHeight());
-  }
-
-  public final Rectangle2D getAlignBounds(float x, float y) {
-    if (ab == null) {
-      ab = createAlignBounds();
-    }
-    return new Rectangle2D.Float((float)(ab.getX() + x),
-                                 (float)(ab.getY() + y),
-                                 (float)ab.getWidth(),
-                                 (float)ab.getHeight());
-  }
-
-  public Rectangle2D getItalicBounds(float x, float y) {
-    if (ib == null) {
-      ib = createItalicBounds();
-    }
-    return new Rectangle2D.Float((float)(ib.getX() + x),
-                                 (float)(ib.getY() + y),
-                                 (float)ib.getWidth(),
-                                 (float)ib.getHeight());
-
-  }
-
-  public Rectangle getPixelBounds(FontRenderContext frc, float x, float y) {
-      return getGV().getPixelBounds(frc, x, y); // no cache
-  }
-
-  public AffineTransform getBaselineTransform() {
-      Font font = source.getFont();
-      if (font.hasLayoutAttributes()) {
-          return AttributeValues.getBaselineTransform(font.getAttributes());
-      }
-      return null;
-  }
-
-  public Shape getOutline(float x, float y) {
-    return getGV().getOutline(x, y);
-  }
-
-  public void draw(Graphics2D g, float x, float y) {
-    g.drawGlyphVector(getGV(), x, y);
-  }
-
-  protected Rectangle2D createLogicalBounds() {
-    return getGV().getLogicalBounds();
-  }
-
-  protected Rectangle2D createVisualBounds() {
-    return getGV().getVisualBounds();
-  }
-
-  protected Rectangle2D createItalicBounds() {
-      // !!! fix
-    return getGV().getLogicalBounds();
-  }
-
-  protected Rectangle2D createAlignBounds() {
-    return createLogicalBounds();
-  }
-
-  private GlyphVector getGV() {
-    if (gv == null) {
-      gv = createGV();
-    }
-
-    return gv;
-  }
-
-  protected GlyphVector createGV() {
-    Font font = source.getFont();
-    FontRenderContext frc = source.getFRC();
-    int flags = source.getLayoutFlags();
-    char[] context = source.getChars();
-    int start = source.getStart();
-    int length = source.getLength();
-
-    GlyphLayout gl = GlyphLayout.get(null); // !!! no custom layout engines
-    StandardGlyphVector gv = gl.layout(font, frc, context, start, length,
-                                       flags, null); // ??? use textsource
-    GlyphLayout.done(gl);
-
-    return gv;
-  }
-}